﻿using System.Data;
using System.Data.SqlClient;

using Sunyi.Project.WebPoint.Configuration;

namespace Sunyi.Project.WebPoint.DataAccess
{
    public class ConnectionProvider
    {
        public static SqlConnection CreateConnection()
        {
            return new SqlConnection(SystemConfiguration.DBConnectionString);
        }

        public static void CloseConnection(IDbConnection connection)
        {
            if (connection != null && connection.State != ConnectionState.Closed)
            {
                connection.Close();
            }
        }
    }
}
